<!DOCTYPE html>
<html class="feedback">
	<head>
			<meta charset="UTF-8" />
			<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
			<title>取消订单</title>
			<link rel="stylesheet" type="text/css" href="/css/mui.min.css" />
			<link rel="stylesheet" type="text/css" href="/css/feedback.css" />
	</head>
	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<button id="submit" class="mui-btn mui-btn-blue mui-btn-link mui-pull-right">确定</button>
			<h1 class="mui-title">取消订单</h1>
		</header>
		<div class="mui-content">
			<div class="mui-content-padded">
				<div class="mui-inner-wrap">取消原因</div>
				<div class="row mui-input-row">
					<textarea id="cancel_cause" class="mui-input-clear question" placeholder="请描述你取消订单的原因..."></textarea>
				</div>
			</div>
		</div>
		<script src="/js/mui.min.js"></script>
		<script type="text/javascript">
			mui.init();
			mui('body').on('tap', "#submit", function() {
				var cancel_cause = mui('#cancel_cause')[0].value;
				if (!cancel_cause || cancel_cause == "") {
					mui.alert('请填写取消原因！');
				} else {
					// TODO::Ajax 请求
                    mui.post('/my/order_cancel',{
                        	_token:'{{csrf_token()}}',
                        	order_id: '{{$orderId}}',
                        	srvNote: cancel_cause
                        },function(data){
							if(data.code!=0){
                                mui.alert(data.msg);
							}else {
                                mui.alert('取消订单的请求已经提交', function() {
                                    window.location.href = "/my/orders";
                                });
							}
                        },'json'
                    );
				}
			});
		</script>
	</body>
</html>
